function adduser(){
	var name=$("#cu_name2").val();
	if(name!=''){
		$.ajax({
			type:'post',
			url:'checkUnique_action',
			dataType:'json',
			data:{table:'zb050h',name:'cu_name',value:name,remark:'客戶'},
			success:check_u_status,
			error:function(){alert("error");}
		});
	}else{
		alert("不能為空");
	}
}

function check_u_status(data){
	if(data.status===0){
		$.ajax({
			url:'userinfo_save',
			type:'post',
			data:{cu_name:name,operator:'1',ajax:1},
			dataType:'json',
			success:adduser_status,
			error:function(){alert('error');}
		});
	}else if(data.status===1){
		alert(data.info);
	}
}

function adduser_status(data){
	if(data.status===1){
		alert(data.data);
		location.reload();
	}else{
		alert(data.data);
	}
}